import http from '@ohos.net.http';
import hiTraceMeter from '@ohos.hiTraceMeter';

const TAG:string = 'tencent'

export async function get100kFile() {
  hiTraceMeter.startTrace("get100kFile111", 1);
  hiTraceMeter.startTrace("get100kFile222", 2);
  let num: number = 0
  for (let index = 0; index < 100000; index++) {
    num = index - 1;
  }
  hiTraceMeter.finishTrace("get100kFile222", 2);
  let httpRequest = http.createHttp();
  httpRequest.request(
    "https://www.baidu.com/",
    {
      method: http.RequestMethod.GET, // 可选，默认为http.RequestMethod.GET
      connectTimeout: 5000, // 可选，默认为60s
      readTimeout: 5000, // 可选，默认为60s
    }, (err, data) => {
    if (!err) {
      console.log(TAG, "get successfully")
      return 0 // 8+
    } else {
      httpRequest.destroy();
      return 0
    }
    return 0
  }
  );
  hiTraceMeter.finishTrace("get100kFile111", 1);
  return 0
}

export async function post100kFile() {


}
